<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Edit Drug</title>
<link href="<s:url value="/style.css"/>" rel="stylesheet"
	type="text/css" />
</head>
<body>
<jsp:include page="/navigation/navigation.jsp" />
	<div id="mainBox">
		<center>
			<s:if test="actionMode=='create'" >
				<h3>Create Drug</h3>
			</s:if>
			<s:else>
				<h3>Update Drug</h3>
			</s:else>
			
				<s:form name="editDrugForm" action="editDrug" method="post">
					<table width="300px">
						<s:if test="actionMode=='update'" >
							<tr>
								<td>Drug Id:</td>
								<td><s:property value="retrievedDrug.drugId"/></td>
							</tr>
						</s:if>
						<s:textfield name="retrievedDrug.drugName" label="Drug Name"/>
						<tr>
							<td>Type:</td>
							<td>
								<select name="retrievedDrug.type" >
									<s:iterator value="DrugTypeMap" var="drugType">
							    		<option value="<s:property value="#drugType.key"/>"
							    		<s:if test="id==#drugType.key">selected = "selected"</s:if>
							    		><s:property value="#drugType.value"/></option>
									</s:iterator>
								</select>
							</td>
						</tr>
						
						<s:if test="actionMode=='create'" >
							<s:submit value="Create" method="createDrug"/>
						</s:if>
						<s:else>
							<s:hidden name="retrievedDrug.drugId" value="%{retrievedDrug.drugId}" />
							<s:submit value="Save" method="updateDrug"/>
						</s:else>
					</table>
					
				</s:form>
				<div id="actionResult"><s:property value="#session.actionResult"/></div>
		</center>
	</div>
</body>
</html>